package cate.common.table.call.sheet;

import cate.common.table.ESheet;
import cate.common.table.call.row.CallSpecialCheatRow;

public class CallSpecialCheatSheet extends ESheet<CallSpecialCheatRow> {
    @Override
    public String getSheetName() {
        return "召唤作弊";
    }

    public int calcNextSpecialCheatTimes(byte callMode, int callTimes) {
        for (CallSpecialCheatRow row : getList()) {
            if (callMode == row.callMode && row.calcRemainTimes && row.times > callTimes) {
                return row.times;
            }
        }
        return -1;
    }

    /**
     * 根据召唤模式和召唤次数判断是否需要作弊
     */
    public CallSpecialCheatRow getRow(int callMode, int times) {
        if (list.isEmpty()) {
            return null;
        }
        for (CallSpecialCheatRow row : list) {
            //循环的话
            if (callMode == row.callMode && row.startTime <= times && row.endTime >= times) {
                return row;
            }
        }
        return null;
    }
}
